home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2785 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.2 KB  |  53 lines

  1. Path: newsfeed.direct.ca!usenet
  2. From: qjackson@direct.ca
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: class defined after use?
  5. Date: Fri, 19 Jan 1996 18:19:58 GMT
  6. Organization: Parsepolis Software
  7. Message-ID: <4don9o$qk1@grid.direct.ca>
  8. References: <4d4l4a$ecg@news1.wolfe.net>
  9. Reply-To: qjackson@direct.ca
  10. NNTP-Posting-Host: 204.174.249.47
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. mgooding@wolfe.net (Joshua Gooding) wrote:
  14.  
  15. >Is it possible to have a class with a pointer to a variable of another 
  16. >type that is defined later int he file?
  17.  
  18. Yes.  If the member data is only a **pointer** to the class, you can
  19. forward declare a class thus:
  20.  
  21. class myClass;
  22.  
  23. As in:
  24.  
  25. class forwardFoo;
  26.  
  27. class fooClass
  28. {
  29.     //someFoo
  30.     forwardFoo* Baz;  // forwardFoo baz; would be illegal here
  31.     //someBar
  32. };
  33.  
  34. [... reams of code ...]
  35.  
  36. class forwardFoo
  37. {
  38.     //yetMoreFooBar
  39. };
  40.  
  41.  
  42. Cheers,
  43.  
  44.  
  45.  
  46.  
  47. --      \|/                              O      |
  48.        --+--    Parsepolis Software     -*-   --|-- Quinn Tyler Jackson
  49.         /|\         "Parse City"        /^\     |     (aka 'Jamshid')
  50. >-----------------------------------------------|   qjackson@direct.ca
  51.        Ask me about Laleh's Pattern Matcher...  |--------------------->
  52.  
  53.